﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;

/// <summary>
/// Summary description for ServiceDto
/// </summary>
public class ServiceDto
{
    #region "var"
    private string _serviceName;
    private int id_ST;
    private bool _status;

    
    private List<ServiceDetail> _listServiceDetail;

    
    #endregion

    #region "properties"
    public bool Status
    {
        get { return _status; }
        set { _status = value; }
    }
    public int Id_ST
    {
        get { return id_ST; }
        set { id_ST = value; }
    }
    public string ServiceName
    {
        get { return _serviceName; }
        set { _serviceName = value; }
    }
    public List<ServiceDetail> ListServiceDetail
    {
        get { return _listServiceDetail; }
        set { _listServiceDetail = value; }
    }  
    #endregion
	public ServiceDto()
	{
        _listServiceDetail = new List<ServiceDetail>();        
	}
    public ServiceDto(DataRow row)
    {
        this.id_ST = (int)row["id_ST"];
        this._serviceName = (string)row["_serviceName"];
        this._status = bool.Parse(row["_status"].ToString());
    }
    public ServiceDto(int id_ST, string _serviceName)
    {
        this.id_ST = id_ST;
        this._serviceName = _serviceName;

    }
    public ServiceDto(DataTable table)
    {
        this.ListServiceDetail = this.MakeListServiceDetail(table);
    }
    public List<ServiceDetail> MakeListServiceDetail(DataTable table)
    {
        List<ServiceDetail> list = new List<ServiceDetail>();
        foreach (DataRow row in table.Rows)
        {
            list.Add(new ServiceDetail(row));
        }
        return list;
    }

} 